package com.itany.ums;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/showAddServlet")
public class ShowAddServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=utf8");
        PrintWriter out = resp.getWriter();

        out.print("<!DOCTYPE html>");
        out.print("<html lang=\"en\">");
        out.print("<head>");
        out.print("    <meta charset=\"UTF-8\">");
        out.print("    <title>Title</title>");
        out.print("    <style>");
        out.print("        .container{");
        out.print("            width: 70%;");
        out.print("            margin: 0 auto;");
        out.print("            padding: 20px;");
        out.print("        }");
        out.print("    </style>");
        out.print("</head>");
        out.print("<body>");
        out.print("    <div class=\"container\">");
        out.print("        <h2>添加用户</h2>");
        out.print("        <form action=\"addServlet\" method=\"post\">");
        out.print("            <p>姓名：<input type=\"text\" name=\"name\"></p>");
        out.print("            <p>密码：<input type=\"passowrd\" name=\"pwd\"></p>");
        out.print("            <p>年龄：<input type=\"text\" name=\"age\"></p>");
        out.print("            <p>");
        out.print("                性别：");
        out.print("                <input type=\"radio\" name=\"sex\" value=\"male\" checked>男");
        out.print("                <input type=\"radio\" name=\"sex\" value=\"female\">女");
        out.print("            </p>");
        out.print("            <p>");
        out.print("                爱好：");
        out.print("                <input type=\"checkbox\" name=\"hobby\" value=\"program\">编程");
        out.print("                <input type=\"checkbox\" name=\"hobby\" value=\"sports\">运动");
        out.print("                <input type=\"checkbox\" name=\"hobby\" value=\"sleep\">睡觉");
        out.print("            </p>");
        out.print("            <p>");
        out.print("                简介：<textarea name=\"info\" cols=\"30\" rows=\"10\"></textarea>");
        out.print("            </p>");
        out.print("            <p>");
        out.print("                <input type=\"submit\" value=\"添加\">");
        out.print("            </p>");
        out.print("        </form>");
        out.print("    </div>");
        out.print("</body>");
        out.print("</html>");

        out.close();
    }
}
